require 'rubygems'
require 'xml'

STDOUT.sync = true;

codelist = ['ACCT', 'BIEN','BTEC','CBME','CENG','CHEM','CIEM','CIVL','COMP','CSIT',
  'ECON','EEMT','EESM','ELEC','ENEG','ENGG','ENVR','ENVS','EVNG','EVSM',
  'FINA','FYTG','GBUS','GNED','HART','HLTH','HUMA','IBTM','IELM','ISOM',
  'JEVE','LABU','LAGR','LANG','LIFS','MAFS','MALS','MARK','MATH','MECH',
  'MESF','MGMT','NANO','PDEV','PHYS','RMBI','SBMT','SCED','SCIE','SHSS','SOSC','SSMA','TEMG','UROP']

all = XML::Document.new
all.root = XML::Node.new('UST')

(0..codelist.length-1).each do |i|
	d1 = XML::Document.file(codelist[i]+".xml")
	all.root << all.import(d1.root)
end

all.save('UST.xml', :indent=>true, :encoding => XML::Encoding::UTF_8)